<?php
/**
 * Created by PhpStorm.
 * User: dell
 * Date: 2018/4/30
 * Time: 16:17
 */

namespace app\common\model;
use think\Model;

class GoldOrder extends Model{
    //生成订单
    public function saveorder($data){
       $res =  $this->allowField(true)->save($data);
       if(!$res){
           return false;
       }
       return $res;
    }
    //获取消费记录
    public function getExpense($data){
        $res = $this->alias('o')
                    ->field('pay_gold,account,number,out_trade_no,remark,o.status,create_time,m.menuname')
                    ->join('__MENU_CONTENT__ m','m.id=o.bid','LEFT')
                    ->where('o.uid',$data['uid'])
                    ->select();
        if(!$res){
            return show(400,'获取失败');
        }
        return show(200,'获取数据成功',$res);
    }
}